package club.guadazi.wemarket.service.impl;

import club.guadazi.wemarket.dao.UserMapper;
import club.guadazi.wemarket.entity.TUser;
import club.guadazi.wemarket.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Mariaaron on 16/9/3.
 */
@Service("userService")
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;

    public List<TUser> searchByKeyWord(String keyword) {
        List<TUser> userDTOs = userMapper.searchByKeyWord(keyword);
        return userDTOs;
    }

    public List<TUser> getUsers() {
        return userMapper.getUsers();
    }

    public void addUser(TUser user) {
        userMapper.insertUser(user);
    }

    public void removeUser(int id) {
        userMapper.removeUser(id);
    }

    public void updateUser(TUser user) {
        userMapper.updateUser(user);
    }
}
